<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>入住登记</title>
    <meta name="viewport" content="initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" href="/favicon.ico">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">

    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css">
    <link rel="stylesheet" href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css">

    <style>
        .bodyDiv{
            width: 98%;
            margin: 2.3rem auto;
        }

        .item-content{
            width: 90%;
            height: 2rem;

            margin: 0.25rem auto;
            border-radius: 0.25rem;
        }
        .item-title span{
            font-size: 0.7rem;
            margin-right: 1.5rem;
        }
        .item-title{
            text-align: right;
        }
        .submitDiv{
            width: 80%;
            margin: auto;
            padding-bottom: 0.9rem;
        }
        .list-block input[type=text]{
            font-size: 0.7rem;
        }

    </style>
</head>
<body>
<div class="page-group">
    <div class="page page-current">
        <header class="bar bar-nav">
            <a class="icon icon-left pull-left"href="/index.php/api/index/room_manage"></a>
            <a class="icon icon-refresh pull-right"></a>
            <h1 class="title">入住登记</h1>
        </header>
        <div class="bodyDiv">
            <!--表单-->
            <div class="list-block">
                    <ul>
                        <!-- Text inputs -->
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*姓名：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text" id="custom_name">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*身份证：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="custom_id_card">
                                    </div>
                                </div>
                            </div>
                        </li>

                        <!-- Select -->
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*性别：</span>
                                    </div>
                                    <div class="item-input">
                                        <select style="font-size: 0.7rem;"id="custom_sex">
                                            <option style="font-size: 0.7rem;">男</option>
                                            <option style="font-size: 0.7rem;">女</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*民族：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="custom_nation">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*户籍地址：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="custom_residence">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*签发机关：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="custom_police_address">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*有效日期：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="custom_valid_date">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*出生日期：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="custom_birth_date">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*房屋编号：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="room_code">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*随行人数：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="retinue">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li>
                            <div class="item-content">
                                <div class="item-inner">
                                    <div class="item-title label">
                                        <span>*房间数量：</span>
                                    </div>
                                    <div class="item-input">
                                        <input type="text"id="room_number">
                                    </div>
                                </div>
                            </div>
                        </li>
                        <li style="height: 5rem;">
                            <div class="item-content">

                                        <div class="submitDiv">
                                            <p><a href="#" id="submit_add" class="button button-fill button-big">提交</a></p>
                                        </div>

                            </div>

                        </li>
                    </ul>
            </div>
        </div>



    </div>
</div>

<script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
<script>
    $(document).ready(function(){
        $('#submit_add').click(function () {
            $.ajax({
                type: "POST",
                data: {
                    custom_name: $('#custom_name').val(),
                    custom_id_card: $('#custom_id_card').val(),
                    custom_sex: $('#custom_sex').val(),
                    custom_nation: $('#custom_nation').val(),
                    custom_residence: $('#custom_residence').val(),
                    custom_police_address: $('#custom_police_address').val(),
                    custom_valid_date: $('#custom_valid_date').val(),
                    custom_birth_date: $('#custom_birth_date').val(),
                    room_code: $('#room_code').val(),
                    room_number: $('#room_number').val(),
                    retinue: $('#retinue').val(),
                },
                url: "/index.php/api/room_orders/addOrder",
                success: function (data) {
                    alert(data.msg)
                    if(data.msg=="添加成功"){
                        setTimeout("window.location.href='/index.php/api/index/room_manage';",2000)
                    }
                }
            })
        })

        function GetQueryString(name)
        {
            var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
            var r = window.location.search.substr(1).match(reg);
            if(r!=null)return  unescape(r[2]); return null;
        }

      // 插入房间编号
        function insertRoomCode() {
            var room_code =GetQueryString("room_code");
            $('#room_code').val(room_code);
        }
        insertRoomCode();
    });
</script>
</body>
</html>